package palette;

import java.awt.*;


/**************************************************
*       CurrentColor is a Singleton
**************************************************/
public class CurrentColor extends Color{

	private static final long serialVersionUID = 1L;
	
	private static CurrentColor inst= null;
	
	/**********************************************
	 *   instance creator
	**********************************************/
	public static CurrentColor getInstance(){
		if(inst == null){
			inst = new CurrentColor();
		}
		return inst;
	}
	
	@Override
	public String toString() {
		String rgb = new String();
		rgb = "("+ this.getRed() +","+ this.getGreen() +","+ this.getBlue() +")";
		return rgb;
	}
	
	/**********************************************
	 *   CONSTRUCTORS
	**********************************************/
	protected CurrentColor(){
		this(Color.black);
	}
	
	protected CurrentColor(Color c){
		super(c.getRGB());
	}

	/**********************************************
	 *   Reset the current color
	**********************************************/
	
	public void setColor(Color c) {
		inst = new CurrentColor(c);
	}
}
